package com.baizhi.controller;

import com.baizhi.annotation.AdminLogAnnotation;
import com.baizhi.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

@Controller
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private AdminService adminService;

    @RequestMapping("/login")
    @AdminLogAnnotation("登录完成了")
    public String login(String userName,String password){
        Map map = adminService.login(userName, password);
//        测试
//        System.out.println(userName+""+password);
        boolean msg = (boolean) map.get("msg");
        if(msg){
            return "redirect:/main/main.jsp";
        }
        return "redirect:/login.jsp";
    }
}
